Skip to content

Fix(sqlglotc): pin sqlglot to the exact matching version#7730

Merged
georgesittas merged 3 commits into
mainfrom
jo/steplock_pin
Jun 11, 2026
Merged

Fix(sqlglotc): pin sqlglot to the exact matching version#7730
georgesittas merged 3 commits into
mainfrom
jo/steplock_pin

Conversation

@georgesittas

Copy link
Copy Markdown
Collaborator

Upgrading sqlglot without upgrading sqlglotc currently breaks silently: the stale compiled
tokenizer_core extension shadows the newer tokenizer_core.py, so the compiled TokenType enum
lacks newly added members while the pure (never-compiled) tokens.py references them. The result is
an import-time crash whose message on Python ≤ 3.11 is just the bare member name, e.g.
AttributeError: LLRR_ARROW after <<->> support landed in v30.9.0 — reproducible with
sqlglot==30.10.0 + sqlglotc==30.8.0 on Python 3.11.

The coupling today is one-directional: the sqlglotc=={version} pin only lives in sqlglot's [c]
extra, and pip does not remember extras on upgrade, so pip install -U sqlglot leaves an old
sqlglotc behind.

This makes the pin bidirectional by having sqlglotc declare sqlglot==<its own version> in its
metadata:

  • CI wheel/sdist builds resolve the version from git via setuptools-scm (exact at release tags)
  • Rebuilds from a published sdist (no git) read the frozen version from PKG-INFO
  • Dev builds (.dev versions) skip the pin, since no matching sqlglot release exists on PyPI;
    local development uses build_ext --inplace and never installs the dist anyway

With this, resolvers keep the two packages in lockstep: uv/poetry refuse to create a skewed
environment, and pip surfaces a clear conflict naming both packages instead of a cryptic one-word
AttributeError at import time.

Verified by generating metadata through setup.py egg_info for both branches: a git checkout at a
dev version emits no pin, and a simulated sdist rebuild emits sqlglot==30.10.0 in requires.txt.

This comment was marked as outdated.

@github-actions

This comment was marked as off-topic.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread sqlglotc/setup.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@georgesittas georgesittas merged commit 1955881 into main Jun 11, 2026
9 checks passed
@georgesittas georgesittas deleted the jo/steplock_pin branch June 11, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants